class CashTradeModel:
    def __init__(self, res):
        self.symbol = res.get('symbol', 'ETHUSDT')  # 默认交易币种
        self.id = res.get('id', None)  # 订单id
        self.orderId = res.get('orderId', None)  # 订单id
        self.orderListId = res.get('orderListId', None)
        self.clientOrderId = res.get('clientOrderId', None)
        self.transactTime = res.get('transactTime', None)
        self.price = res.get('price', None)  # 交易价格
        self.origQty = res.get('origQty', res.get('qty', None))  # 交易总数量
        self.executedQty = res.get('executedQty', res.get('qty', None)) # 实际交易数量
        self.cummulativeQuoteQty = res.get('cummulativeQuoteQty', res.get('quoteQty', None))
        self.status = res.get('status', None)  # 当前订单状态
        self.timeInForce = res.get('timeInForce', res.get('time', None))
        self.type = res.get('type', None)  # 当前订单类型
        self.side = res.get('side', None)  # 当前订单方向 buy|sell，初始时为None
        if res.get('fills', None) != None:
            self.fills = list(map(self.setTradeFill, res['fills']))
        else:
            self.fills = None

    def setTradeFill(sef, data):
        return CashTradeFillModel(data)

class CashTradeFillModel:
    def __init__(self, res):
        self.price = res['price']
        self.qty = res['qty']
        self.commission = res['commission']
        self.commissionAsset = res['commissionAsset']
        self.tradeId = res['tradeId']
